/**
 * Copyright 2016 JustWayward Team
 * <p/>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.ljfiction.book.readview;


/**
 * @author lfh.
 * @date 2016/8/7.
 */
/*public class BookReadPresenter extends RxPresenter<BookReadContract.View>
        implements BookReadContract.Presenter<BookReadContract.View> {

    private Context mContext;
    private String url;


    public BookReadPresenter(Context mContext, String url) {
        this.mContext = mContext;
        this.url = url;
    }*/

    /*@Override
    public void getBookMixAToc(final String bookId, String viewChapters) {
        String key = StringUtils.creatAcacheKey("book-toc", bookId, viewChapters);
        Observable<Bookchapters.DataBean.ChapterInfoBean.ResultListBean> fromNetWork = getBookChapters(bookId, viewChapters)
                .map(new Func1<Bookchapters, Bookchapters.DataBean>() {
                    @Override
                    public Bookchapters.DataBean call(Bookchapters data) {
                        return data.getData();
                    }
                })
                .compose(RxUtil.<Bookchapters.DataBean.ChapterInfoBean.ResultListBean>rxCacheListHelper(key));
*/
        /*//依次检查disk、network
        Subscription rxSubscription = Observable
                .concat(RxUtil.rxCreateDiskObservable(key, Bookchapters.DataBean.ChapterInfoBean.class), fromNetWork)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<Bookchapters.DataBean.ChapterInfoBean>() {
                    @Override
                    public void onNext(Bookchapters.DataBean.ChapterInfoBean data) {
                        List<Bookchapters.DataBean.ChapterInfoBean.ResultListBean> list = data.getResultList();
                        if (list != null && !list.isEmpty() && mView != null) {
                            mView.showBookToc(list);
                        }
                    }

                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                        //LogUtils.e("onError: " + e);
                        mView.netError(0);
                    }
                });
        addSubscrebe(rxSubscription);
    }*/

    /*@Override
    public void getChapterRead(String url, final int chapter) {
        Subscription rxSubscription = bookApi.getChapterRead(url).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<ChapterContext.DataBean>() {
                    @Override
                    public void onNext(ChapterContext.DataBean data) {
                        if (data.getChapterInfo() != null && mView != null) {
                            mView.showChapterRead(data.getChapterInfo(), chapter);
                        } else {
                            mView.netError(chapter);
                        }
                    }

                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                        LogUtils.e("onError: " + e);
                        mView.netError(chapter);
                    }
                });
        addSubscrebe(rxSubscription);
    }
    private Observable<Bookchapters> data;

   private Observable<Bookchapters> getBookChapters(String bookid, String viewChapters) {
        return data;
    }*/
/*
}*/
